
******************************************************
*  CALCULATING VARIOUS NUMBERS WE CITE IN THE TEXT 
*  nothing saved, just here for reproduction
******************************************************

*====READING IN DATA =============================
*New stringency and pro se variables
tempfile courtvars laggedoutcomes
use "${build}/Data_ready_with_instruments.dta", clear
keep if iv_sample == 1
replace amount = 0 if amount == .
replace amount = 10000 if amount > 10000 & amount != .

label var amount "Judgment amount"
label var sheriff_eviction_completed "Sheriff completed eviction order"
label var future_case_at_same_addr "Future eviction case at same address"
merge 1:1 unique_id using  "${build}/comp_weights_for_data_ready_with_instruments.dta"
drop _merge

*Create the missing indicators
foreach var of varlist median_rent pct_below_povline pred_bla pred_his fem1 {
	replace `var'=-1 if `var'==.
	gen `var'_miss=`var'==-1
}

gen c_evict = evicted
encode districtxyear, gen(districtXyear)
encode judgeyear, gen(judgeXyear)

*====CORRELATION BETWEEN AD DAMNDUM AMOUNT AND JUDGMENT AMOUNT:

* Correlation including 0s.
cor  amount  ad_damnum  if evicted == 1 & joint == 1 & amount <=10000 & ad_damnum <= 10000 & iv_sample == 1 & ad_damnum >= 0 

* Correlation excluding 0s.
cor  judgment_amount ad_damnum if evicted == 1 & joint == 1 & judgment_amount <=10000 & ad_damnum <= 10000 & ad_damnum >=0









